﻿namespace Isaac.Joy.Identity.Module
{
    public class Role
    {
        /// <summary>
        /// 角色编号
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 角色权限值
        /// </summary>
        internal string Value { get; set; }

        /// <summary>
        /// 角色权限值
        /// </summary>
        public FlagsValue FlagsValue
        {
            get
            {
                return new FlagsValue(Value);
            }
            set { Value = value.ToString(); }
        }

        /// <summary>
        /// 判断功能是否可用
        /// </summary>
        /// <param name="value">功能对应权限值</param>
        /// <returns></returns>
        public bool Enabled(FlagsValue value)
        {
            return FlagsValue.Enabled(value);
        }
    }
}
